/**
 * @(#)ThriftClient.java, 2019/1/4
 * <p/>
 * Copyright 2019 Netease, Inc. All rights reserved.
 * NETEASE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */
package com.chengzhi.netty.thrift;

import org.apache.thrift.TException;
import org.apache.thrift.protocol.TBinaryProtocol;
import org.apache.thrift.transport.TSocket;
import org.apache.thrift.transport.TTransport;
import org.apache.thrift.transport.TTransportException;

/**
 * @author 阮承志(wb.ruanchengzhi @ mesg.corp.netease.com)
 **/
public class ThriftClient {
    public static void main(String[] args) throws TTransportException {
        TTransport socket = new TSocket("localhost", 8888);
        socket.open();
        TBinaryProtocol protocol = new TBinaryProtocol(socket);
        PersonService.Client client = new PersonService.Client(protocol);
        try {
            Person person = client.getPersonByName("ss");
            client.savePerson(person);
            socket.close();
        } catch (TException e) {
            e.printStackTrace();
        }

    }
}
